package com.zt.bigdata.repository;

import com.zt.bigdata.document.Customer;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.mongodb.repository.MongoRepository;

import java.util.List;

/**
 * @Author: zhangtong
 * @Date: 2018/9/13 下午5:40
 */

public interface CustomerRepository extends MongoRepository<Customer, String> {
    Page<Customer> findByDelFlag(Boolean delFlag, Pageable pageable);

    Customer findOneByAge(Integer age);

    Page<Customer> findByName(String name, Pageable pageable);

    Page<Customer> findByAge(int age, Pageable pageable);

    List<Customer> findAllByAddress(String address);

    Page<Customer> findByAgeGreaterThan(int age, Pageable pageable);

    Page<Customer> findByNameNotNull(Pageable pageable);

    Page<Customer> findByNameLike(String name, Pageable pageable);

    List<Customer> deleteByName(String name);

    Long deleteCustomerByName(String name);

    void deleteCustomerByAge(Integer age);

    void deleteAllByDelFlag(Boolean delFlag);
}
